package ddhost.cbs;

// エラーログを保存するスレッド

import java.io.File;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;


public class errorLogWriter extends Thread implements Runnable {

	String mess = "null";
	
	public errorLogWriter(String _mess){
		mess = _mess;
	}
	
	@Override
	public void run() {
		
		mess += "\n";
		
		byte[] bytes = null;
		try {
			bytes = mess.getBytes("UTF-8");
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		File file = new File("/sdcard/umLog.txt");
		
		try {
			OutputStream output = new FileOutputStream(file,true);
			
			output.write(bytes);
			
			output.flush();
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}
	
}
